Sun, Sun Microsystems, JVM, Java, are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. Microsoft® .NET is a brand associated with Microsoft technology. Microsoft® .NET is software for connecting people, information, systems, and devices. Visual Basic is a registered trademark of Microsoft in the United States and other countries.
The Microsoft® .NET framework is a new platform for building integrated, service-oriented, applications to meet the needs of today's and future Internet businesses. The .Net platform allows developers to take better advantage of technologies than any earlier Microsoft platform. Specifically, the .NET platform provides for code reuse, code specialization, resource management, multi-language development, security, deployment and administration.
A .NET application can be executed on any platform that supports the .NET common language runtime (CLR). The .Net platform allows different programming languages to be integrated with one another. For example, it is possible to create a class in C++ that is derived from a class implemented in Visual Basic. The programming languages supported by the .Net platform include, but are not limited to, C++ with managed extensions, C# (C-Sharp), Visual Basic, Pascal, COBOL, JavaScript and many others. Notably, the source code written in these languages requires the CLR engine in order to execute.
The Java programming environment has recently gained significant popularity. The Java programming language is a language that is designed to be portable enough so that it can be executed on a wide range of computers, ranging from small devices, such as a personal digital assistant (PDA), cell phone, and smart cards, all the way to high-end supercomputers. Computer programs written in the Java programming language are compiled into Java bytecode instructions that are suitable for execution by a Java virtual machine (JVM).
Applications designed with the .Net platform cannot execute on a JVM. As a result, developers cannot integrate the advantages inherent to .Net with the capabilities provided by the Java runtime environments. To overcome this limitation, compilers that enable the execution of .Net applications on JVM have been introduced. These compilers (hereinafter the “IL2J compilers”) decode Microsoft intermediate language (MSIL) instructions and produce Java bytecodes instructions. An example of such a compiler is disclosed in U.S. patent application Ser. No. 10/437,518 entitled “Compiler and Software Product for Compiling Intermediate Language Bytecodes into Java Bytecodes,” assigned to common assignee and incorporated herein by reference for all that it contains.
Besides the need to compile MSIL instructions into Java bytecodes, there is also a necessity to compile other software mechanisms introduced by the .Net platform, to allow a full adaptation to Java. One of these mechanisms is the reflection, used to discover class information solely at runtime. Specifically, the reflection allows invoking data members at runtime, determining the class of an object, finding what constants and method declarations belong to an interface, creating an instance of a class whose name is not known until runtime, and retrieving as well as setting a value of a data member, even if the data member name is unknown until runtime.
There are many differences between the reflection mechanisms, or application programming interfaces (API's), provided by the Java and .Net frameworks. These differences are mainly related to handling semantic gaps between the programming languages supported by the .Net and the Java programming language and to the fact that attributes in a Java framework are only a subset of those defined in the .Net framework. Furthermore, the two frameworks use different API's to invoke data members at runtime.
It would be therefore advantageous to provide a method and software product capable of adapting the reflection mechanism as defined in the .Net framework to the Java environment.